<template>
	<view class="container">
		<view class="refund-box bg-fff">
			<view class="refund-txt">{{ refundDetail.is_agree.text }}</view>
			<view class="refund-refund" v-if="refundDetail.refuse_desc">原因：{{ refundDetail.refuse_desc }}</view>
			<view class="refund-time" v-if="refundDetail.audit_time_text">{{ refundDetail.audit_time_text }}</view>
		</view>
		<view class="product bg-fff">
			<view class="product-item flex" v-for="(it,idx) in dataInfo.product" :key="idx">
				<image class="product-item-image" :src="it.image.file_path"></image>
				<view class="product-item-con">
					<view class="product-item-name u-line-1">{{it.product_name}}</view>
					<view class="product-item-suk">{{it.product_attr}}</view>
					<view class="flex-space-between">
						<view class="product-item-price">￥{{it.product_price}}</view>
						<view class="product-item-num">x{{it.total_num}}</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="type bg-fff">
			<view class="type-title">服务类型</view>
			
			<view class="type-list flex-align-center">
				<view class="type-item">{{ refundDetail.type.text }}</view>
			</view>
		</view>
		
		<view class="content bg-fff">
			<view class="content-title">退款原因</view>
			<view class="content-title-content flex">
				{{ refundDetail.apply_desc }}
			</view>
		</view>
		
		<view class="total bg-fff flex-space-between">
			<view class="total-title">
				<view>退款金额</view>
				<view v-if="refundDetail.is_agree.value == 10" style="font-size: 22rpx;font-weight: 400;">已退回您的支付账户</view>
			</view>
			<view class="total-price">￥{{dataInfo.pay_price || 0}}</view>
		</view>
		
		<view class="image bg-fff" v-if="refundDetail.image && refundDetail.image.length >0">
			<view class="image-title">退款凭证</view>
			<view class="refund-voucher">
				<image v-for="(ele,index) in refundDetail.image" class="refund-voucher-image" :src="ele.file_path" @click="picture(ele.file_path)"></image>
			</view>
		</view>
		
		<!-- <b-u-button-theme width="630rpx" height="90rpx" size="30rpx" @click="send">确认提交</b-u-button-theme> -->
		
		<safe-area-inset-bottom></safe-area-inset-bottom>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				token: uni.getStorageSync('token'),
				app_id: uni.$setting.appId,
				dataInfo: {},
				form: {
					refund_type: 10,
					content: "",
					images: [],
					order_id: '',
					create_time:'',
				},
				refundDetail:{}
			}
		},
		onLoad(options) {
			this.form.order_id = options.order_id;
			this.getHttp();
		},
		methods: {
			picture(image){
				uni.previewImage({
					urls: [image],
				});
			},

			getRefund() {
				uni.$u.api.getRefund({
					order_id: this.form.order_id,
					platform: 'wx',
				}).then(res => {
					this.dataInfo = res.order;
				})
			},
			getOrderRefundDetail() {
				uni.$u.api.getOrderRefundDetail({
					order_id: this.form.order_id,
				}).then(res => {
					this.refundDetail = res.detail
				})
			},
			getHttp() {
				this.getRefund();
				this.getOrderRefundDetail();
			},
		},
	}
</script>

<style lang="scss" scoped>
	.container {
		.refund-box {
			padding: 24rpx 40rpx;
			margin-bottom: 20rpx;
			.refund-txt {
				font-size: 40rpx;
				font-weight: bold;
			}
			.refund-refund {
				margin-top: 10rpx;
				color: #E80D0D;
			}
			.refund-time {
				margin-top: 10rpx;
			}
		}
		.product {
			padding: 24rpx 30rpx;
			
			.product-item {
				
				.product-item-image {
					width: 128rpx;
					height: 128rpx;
				}
			
				.product-item-con {
					margin-left: 16rpx;
					flex: 1;
			
					.product-item-name {
						width: 460rpx;
						font-size: 28rpx;
						color: #111111;
					}
			
					.product-item-suk {
						font-size: 24rpx;
						color: #999999;
						margin-bottom: 10rpx;
					}
			
					.product-item-num {
						font-size: 24rpx;
						color: #999999;
					}
			
					.product-item-price {
						font-size: 28rpx;
						color: $uni-color-theme;
					}
				}
			}
			
			.product-item +.product-item {
				margin-top: 20rpx;
			}
		}
		
		.type {
			padding: 30rpx;
			margin: 24rpx 30rpx 0;
			border-radius: 20rpx;
			
			.type-title {
				font-size: 32rpx;
				color: #333333;
				font-weight: bold;
			}
			
			.type-list {
				margin-top: 40rpx;
				
				.type-item {
					font-size: 28rpx;
					padding: 20rpx;
					border-radius: 16rpx;
					margin-right: 32rpx;
					background: #BB0024;
					color: #FFFFFF;
				}
			}
		}
		
		.content {
			padding: 22rpx 30rpx;
			margin: 24rpx 30rpx 0;
			border-radius: 20rpx;
			
			.content-title {
				font-size: 32rpx;
				color: #333333;
				font-weight: bold;
			}
			.content-title-content {
				padding: 20rpx 10rpx;
			}
		}
		
		.total {
			padding: 24rpx 30rpx;
			margin: 24rpx 30rpx 0;
			border-radius: 20rpx;
			
			.total-title {
				font-size: 32rpx;
				color: #333333;
				font-weight: bold;
			}
			
			.total-price {
				font-size: 32rpx;
				color: #E80D0D;
			}
		}
		
		.image {
			padding: 24rpx 30rpx;
			margin: 24rpx 30rpx 52rpx;
			border-radius: 20rpx;
			.refund-voucher {
				display: flex;
				align-items: center;
				flex-wrap: wrap;
				.refund-voucher-image {
					width: 190rpx;
					height: 190rpx;
					border-radius: 10rpx;
					margin: 10rpx;
				}
			}
			.image-title {
				font-size: 32rpx;
				color: #333333;
				font-weight: bold;
				margin-bottom: 20rpx;
				
				text {
					font-size: 24rpx;
					font-weight: normal;
				}
			}
		}
		
		
	}
</style>./refund_after.vue
